<?php
namespace app\admin\form;

class User
{
    public function items($data=[])
    {
        return [
            'user_id' => [
                'type'        => 'hidden',
                'value'       => $data['user_id'],
            ],
            'user_status' => [
                'type'        => 'select',
                'value'       => $data['user_status'],
                'option'      => model('common/Attr','loglic')->status(),
                'required'    => true,
                'title'       => '状态',
                'class_row'   => 'col-6 mb-3',
            ],
            'user_roles' => [
                'type'        => 'select',
                'value'       => xfEmpty($data['user_roles'],['user']),
                'option'      => ['editor'=>'编辑','admin'=>'管理员'],
                'multiple'    => false,
                'size'        => 1,
                'required'    => true,
                'title'       => '角色',
                'class_row'   => 'col-6 mb-3',
            ],
            'user_name' => [
                'type'        => 'text',
                'value'       => $data['user_name'],
                'required'    => false,
                'title'       => '用户名',
                'class_row'   => 'col-6 mb-3',
            ],
            'user_pass' => [
                'type'        => 'password',
                'value'       => '',
                'required'    => false,
                'title'       => '密码（不修改留空）',
                'class_row'   => 'col-6 mb-3',
            ],
            'user_mobile' => [
                'type'        => 'text',
                'value'       => $data['user_mobile'],
                'required'    => false,
                'title'       => '手机号',
                'maxlength'   => 11,
                'class_row'   => 'col-6 mb-3',
            ],
            'user_email' => [
                'type'        => 'text',
                'value'       => $data['user_email'],
                'required'    => false,
                'title'       => '邮箱',
                'class_row'   => 'col-6 mb-3',
            ],
        ];
    }
}